package br.com.sg5.model.dao.impl;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;

import br.com.sg5.model.bean.Municipio;
import br.com.sg5.model.dao.MunicipioDao;

public class MunicipioDaoImpl implements MunicipioDao {

private SessionFactory sessionFactory;
	
	@Autowired
	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public List<Municipio> getMunicipio() {
		Query query = sessionFactory.getCurrentSession().createQuery("from Municipio");
		
		return query.list();
	}

}
